package com.tongji.diy.view
{
	import com.tongji.diy.event.NewDoorEvent;
	import com.tongji.diy.event.NewFurnitureEvent;
	import com.tongji.diy.event.NewWindowEvent;
	import com.tongji.diy.model.RoomBorderChild;
	import com.tongji.diy.model.RoomChildVO;
	import com.tongji.diy.model.RoomDataModel;
	import com.tongji.diy.model.WallDoor;
	import com.tongji.diy.model.WallWindow;
	import com.tongji.diy.view.GoodsItemRenterer;
	
	import flash.display.Bitmap;
	import flash.display.DisplayObject;
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.ui.Mouse;
	import flash.ui.MouseCursor;
	
	import mx.controls.Alert;
	import mx.controls.ToolTip;
	import mx.core.IUIComponent;
	import mx.core.UIComponent;
	import mx.events.DragEvent;
	import mx.events.MoveEvent;
	import mx.managers.DragManager;
	import mx.managers.PopUpManager;
	import mx.managers.ToolTipManager;
	
	import org.robotlegs.mvcs.Mediator;
	
	import spark.components.Group;
	
	/**
	 * 
	 * @author chenchao
	 * 
	 */
	public class GoodsItemRentererMediator extends Mediator
	{
		[Inject]
		public var view:GoodsItemRenterer;
		
		[Inject]
		public var model:RoomDataModel;
		
		override public function onRegister():void
		{
			view.addEventListener(MouseEvent.CLICK, itemClickHandler);
		}
		
		private function itemClickHandler(event:MouseEvent):void
		{
			if (view.data is RoomChildVO)
				dispatch(new NewFurnitureEvent(NewFurnitureEvent.ADD_FURNITURE, view.data as RoomChildVO));
			if (view.data is WallDoor)
				dispatch(new NewDoorEvent(NewDoorEvent.ADD_DOOR, view.data as WallDoor));
			if (view.data is WallWindow)
				dispatch(new NewWindowEvent(NewWindowEvent.ADD_WINDOW, view.data as WallWindow));
		}
	}
}